package com.jt.controller;

import com.jt.pojo.User;
import com.jt.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author :Colin
 * @version 创建时间: 2021/7/30 16:27
 */
@RestController
@CrossOrigin
@RequestMapping("/vue")
public class VueController {
    @Autowired
    private UserService userService;
    @GetMapping("/getUserList")
    public List<User> getUserList(){
        return userService.getAll();
    }
    @PostMapping("/insertUser")
    public void insertUser(@RequestBody User user){
        userService.insertUser(user);
    }
    @DeleteMapping("/deleteUser/{id}")
    public void deleteUser(@PathVariable Integer id){
        userService.deleteUser(id);
    }
    @PutMapping("/updateUserList")
    public void updateUserList(@RequestBody User user){
        userService.updateUserList(user);
    }
}
